import Vue from 'vue';

let app = new Vue({

    computed: {
        name() {

        }
    },
    el: '#app',
    template: '<div>{{text}}-{{obj.a}}</div>',
    data() {
        return {
            obj: {},
            text: 123
        }
    },
    watch: {
        text(newText, oldText) {
            console.log(newText, oldText);
        }

    }
})

// let c = 0;
setInterval(() => {
    // app.$data.obj.a = ++c;
    // app.$forceUpdate()强制渲染，不建议

    // app.$set(app.obj, 'a', c);
    // app.$delete()

    app.text += 1
    app.text += 1
    app.text += 1
    app.text += 1
    app.text += 1

    // app.$nextTick 下次更新的时候，执行
}, 1000)

console.log(app.$options)
console.log(app.$data)
console.log(app.$el)
console.log(app.$props)
console.log(app.$root === app)
console.log(app.$children) //<item><div></div></item> div就是children
console.log(app.$slots)
console.log(app.$refs) //
console.log(app.$isServer) //server 是否可以渲染
console.log(app.$watch) //需要手动注销

app.$on('test', (a, b) => {
    console.log('test', `${a},${b}`)
})

app.$emit('test', 1, 2)

// app.$forceUpdate() //强制渲染
